home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2006 May / PCpro_2006_05.ISO / files / mobile / fma-2.0-stable-setup.exe / {app} / sframework / fma-scripting-framework.vbs < prev    next >
Encoding:
Text File  |  2004-12-18  |  6.7 KB  |  191 lines

  1. 'FMA Script Framework
  2. 'Version 1.0 Beta
  3. 'Developed by streawkceur <twittek@smail.uni-koeln.de> and dVRVm
  4.  
  5. 'Main Program
  6. 'Needs at least FMA 0.33d
  7.  
  8. '$Id: fma-scripting-framework.vbs,v 1.4 2004/12/16 08:21:45 z_stoichev Exp $
  9. '$Log: fma-scripting-framework.vbs,v $
  10. 'Revision 1.4  2004/12/16 08:21:45  z_stoichev
  11. 'Fixed: Changed Global Constants to be Dims.
  12. '
  13. 'Revision 1.3  2004/11/06 20:01:26  voxik
  14. 'Changed KeyManager to properly enable and disable key monitoring.
  15. '
  16. 'Revision 1.2  2004/09/16 07:27:12  z_stoichev
  17. 'Fixed install dir.
  18. '
  19. 'Revision 1.1  2004/09/09 08:00:31  z_stoichev
  20. 'Imported from streawkceur's CVS
  21. '
  22. 'Revision 1.39  2004/03/22 12:04:20  streawkceur
  23. 'Modified Configurator a bit. Added configurator option to exclude some plugins from being loaded. Updated docs.
  24. '
  25. '-Using fma.Sleep now. Configurator forces script to reload settings after it saved th settings. Introduced Util.WaitForAppClose. Updated documentation. Updated Tools plugin, now it should work better. Updated Winamp plugin, now has a dialogue for setting winamp volume. Updated BramusICQ.
  26. '-Now _really_ added ActiveXManager
  27. '-Enhanced AutoMenu plugin. It now directly show a specified plugin menu instead of going to the main menu. See configurator.
  28. '-Checked all files for bad line ends. Now every file should work properly in Notepad.exe :)
  29. '-Keyword test
  30.  
  31. 'FMA-Bugs/-Problems:
  32. '-FMA could check AT command length before TX'ing. Must not be > 250 bytes! May cause an AT error otherwise
  33. '-FMA could check <title> length in AT command that have a title element. It seems that titles must not be >15chars. May cause an AT error otherwise
  34. '-FMA could check against selected item > num items in *EASM command. May cause an AT error otherwise
  35. '-FMA could send multiple EASM commands without final flag to put long menus.
  36.  
  37. 'Core-TODO:
  38. '-Test key monitoring in minimized mode
  39. '-Complete ManagedMenu:
  40. '    -am.ClearMenu, am.Selected, am.DlgOption (which looks like a normal menu...)
  41. '-Remove dummy key registration
  42. '-Version Management?: Framework version, (FMA version), plugins version, plugins dependence on a specific framework version
  43. '-Where is the WScript object? MsgBox WScript.ScriptFullName
  44. '-Complete LinkedList (especially ArrayContainerClass)
  45. '!!!-> See TODO's in each other source file
  46.  
  47. 'DOC-TODO:
  48. '    -More comprehensive LinkedList documentation
  49. '    -Whole core documentation
  50.  
  51. 'Plugins-TODO:
  52. '-Core:
  53. '    -Extend Demo Plugin
  54. '-External:
  55. '    -Finishing needed
  56. '        -Camera: OBEX problem
  57. '        -Winamp: Seek, DlgPercent buggy, winampcomlib doesn't support JumpToTime yet
  58. '        -MasterVolume: DlgPercent buggy, Maybe register VolUp/-Down keys (on side of the phone)
  59. '        -Tools: windows version independent shutdown etc.
  60. '    -Testing
  61. '        -BramusICQ
  62. '        -Hauppauge WinTV (I'm not using WinTV...)
  63. '        -ZoomPlayer
  64. '        -iTunes
  65. '    -Finished:
  66. '        AutoMenu, BSPlayer, Configurator, FileExplorer, MediaCenter, MediaPlayer9, MoreTV, Mouse, MousePlus, OnCallPauseWA, PluginInfo, PowerDVD5, Powerpoint, Test, WinDVD
  67.  
  68. 'Explicit variable declaration neccessary
  69. Option Explicit
  70.  
  71. 'Global Constants
  72. 'File operations
  73. Dim FILE_FOR_READING
  74. Dim FILE_FOR_WRITING
  75. FILE_FOR_READING = 1
  76. FILE_FOR_WRITING = 2
  77.  
  78. 'Global external Objects
  79. Public Fso, Shell
  80. Set Fso   = CreateObject("Scripting.FileSystemObject")
  81. Set Shell = CreateObject("WScript.Shell")
  82.  
  83. Dim ScriptFolder
  84. 'Should be CHANGED to FMA installation folder! 
  85. 'This should be done automaticaly by FMA 2 installer.
  86. ScriptFolder = "C:\Projects\cvsroot\fma\sframework\"
  87.  
  88. '---> Import core classes
  89. '-> Abstact Data Types
  90. Execute(readFile(ScriptFolder & "core\Hash.vbs"))
  91. Execute(readFile(ScriptFolder & "core\Stack.vbs"))
  92. Execute(readFile(ScriptFolder & "core\LinkedList.vbs"))
  93. '-> Managers
  94. Execute(readFile(ScriptFolder & "core\EventManagerClass.vbs"))
  95. Execute(readFile(ScriptFolder & "core\KeyManagerClass.vbs"))
  96. Execute(readFile(ScriptFolder & "core\ManagedMenu.vbs"))
  97. Execute(readFile(ScriptFolder & "core\PluginManagerClass.vbs"))
  98. Execute(readFile(ScriptFolder & "core\ActiveXManagerClass.vbs"))
  99. '-> Others
  100. Execute(readFile(ScriptFolder & "core\QuickSort.vbs"))
  101. Execute(readFile(ScriptFolder & "core\UtilClass.vbs"))
  102. Execute(readFile(ScriptFolder & "core\DebugClass.vbs"))
  103. Execute(readFile(ScriptFolder & "core\SettingsClass.vbs"))
  104.  
  105. '---> Create global objects
  106. Public Util, Debug, QuickSorter, Settings, EventManager, KeyManager, PluginManager, ActiveXManager, EmptyMenu
  107. Set Util           = New UtilClass
  108. Set Debug          = Util.CreateObject("DebugClass", "Debug")
  109. 'Debug.SetDebugLevel DEBUG_LEVEL_OFF
  110. 'Debug.SetDebugLevel DEBUG_LEVEL_ERROR
  111. 'Debug.SetDebugLevel DEBUG_LEVEL_WARN
  112. Debug.SetDebugLevel DEBUG_LEVEL_INFO
  113. Debug.SetDebugLevel DEBUG_LEVEL_DEBUG
  114. 'Debug.SetDebugLevel DEBUG_LEVEL_NOFMA
  115. Set QuickSorter    = New QuickSort
  116. Set EmptyMenu      = New ManagedMenu
  117. Set EventManager   = Util.CreateObject("EventManagerClass", "EventManager")
  118. Set KeyManager     = Util.CreateObject("KeyManagerClass", "KeyManager")
  119. Set Settings       = Util.CreateObject("SettingsClass", "Settings")
  120. Set ActiveXManager = Util.CreateObject("ActiveXManagerClass", "ActiveXManager")
  121. Set PluginManager  = Util.CreateObject("PluginManagerClass", "PluginManager")
  122.  
  123. 'Load Settings
  124. Settings.Load()
  125. 'Import plugins
  126. Execute PluginManager.LoaderString()
  127.  
  128. 'Needed for importing classes and plugins
  129. Function ReadFile(fileName)
  130.     If Fso.FileExists(fileName) Then
  131.         Dim File
  132.         Set File = Fso.OpenTextFile(fileName, FILE_FOR_READING)
  133.         ReadFile = File.ReadAll
  134.         File.Close
  135.     Else
  136.         'Debug.ErrorMsg "ReadFile: File not found: " & fileName
  137.         MsgBox "ReadFile: File not found: " & fileName
  138.         ReadFile = ""
  139.     End If
  140. End Function
  141.  
  142. '''Delegate Events
  143. Sub OnInit ()
  144.     Debug.InfoMsg "FMA Scripting Framework loaded!"
  145.     EventManager.OnEvent "Init", Array()
  146. End Sub
  147.  
  148. Sub OnConnected ()
  149.     Debug.DebugMsg "Initializing accessories menu"
  150.     
  151.     am.Init
  152.     Util.SetStandbyScreenText "fma loaded"
  153.     
  154.     EventManager.OnEvent "Connected", Array()
  155. End Sub
  156.  
  157. Sub OnConnectionLost ()
  158.     EventManager.OnEvent "ConnectionLost", Array()
  159. End Sub
  160.  
  161. Sub OnDisconnected ()
  162.     EventManager.OnEvent "Disconnected", Array()
  163. End Sub
  164.  
  165. Sub OnNewSMS ( Sender, Text )
  166.     EventManager.OnEvent "NewSMS", Array( Sender, Text )
  167. End Sub
  168.  
  169. ' Hmm, no idea what the arguments do...
  170. Sub OnCall (Caption, AlphaCaption, Number)
  171.     EventManager.OnEvent "Call", Array( Caption, AlphaCaption, Number )
  172. End Sub
  173.  
  174. Sub OnAMRoot ()
  175.     EventManager.OnEvent "AMRoot", Array()
  176. End Sub
  177.  
  178. Sub OnProximity ( State )
  179.     EventManager.OnEvent "Proximity", Array( State )
  180. End Sub
  181.  
  182. Sub OnMusicMute ( RtnString )
  183.     EventManager.OnEvent "MusicMute", Array( RtnString )
  184. End Sub
  185.  
  186. Sub OnKeyPress ( Key, Press )
  187.     EventManager.OnEvent "KeyPress", Array( Key, Press )
  188.     ' The keypress manager is supposed to register itself in the event manager.
  189. End Sub
  190.  
  191.